package com.yeswater.multithread.chapter1.test1_11.test8;

import java.util.concurrent.TimeUnit;

/**
 * author : yeswater
 * date : 2023/10/19
 */

public class MyService {

    private String username = "a";

    private String password = "aa";

    synchronized public String getUsername() {
        return username;
    }

    synchronized public String getPassword() {
        return password;
    }

    synchronized public void printString(String username, String password) {
        try {
            this.username = username;
            TimeUnit.SECONDS.sleep(100000);
            this.password = password;
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
